public class demo25 {
    public static void main(String[] args) {
        int a = 10000;
        int count = 0;
        boolean b = true;
        while (true){
            if (a<600&&b){
                break;
            }
            if (b){
                a -=600;
                b = false;
            }else {
                a +=300;
                b =true;
            }
            count++;
        }
        System.out.println(count*60+a/10);
    }
}
